package hhm.javamode.strategy.pay;

public class Context {
	private Strategy strategy;

	public Double calRecharge(Double charge, Class<?> clazz) {
		try {
			strategy = (Strategy) clazz.newInstance();
		} catch (InstantiationException | IllegalAccessException e) {
			e.printStackTrace();
		}
		return strategy.calRecharge(charge);
	}

	public Strategy getStrategy() {
		return strategy;
	}

	public void setStrategy(Strategy strategy) {
		this.strategy = strategy;
	}

}
